package com.hippo.core.Enum;

import lombok.Getter;

/**
 * @ClassName StatusEnum
 * @Description TODO 状态枚举
 * @Author tangxl
 * @Date 2023/4/26 9:01
 **/
@Getter
public enum StatusEnum implements SuperEnum{
    DELETE(0,"删除"),
    NORMAL(1,"正常"),
    DISABLE(2,"锁定");

    private Integer code;
    private String name;

    StatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCodeByName(String name){
        for (StatusEnum statusEnum : StatusEnum.values()) {
            if (statusEnum.getName().equals(name)){
                return statusEnum.getCode();
            }
        }
        return 0;
    }

    public String getNameByCode(Integer code){
        for(StatusEnum statusEnum:StatusEnum.values()){
            if(statusEnum.getCode().equals(code)){
                return statusEnum.getName();
            }
        }
        return "";
    }


}
